home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / lib / partman / finish.d / 20mount_partitions next >
Encoding:
Text File  |  2007-04-12  |  1.5 KB  |  74 lines

  1. #!/bin/sh
  2.  
  3. . /lib/partman/definitions.sh
  4.  
  5. installdir () {
  6.     dir="${1%/}"
  7.     while [ "$dir" ]; do
  8.     dirs="$dir $dirs"
  9.     dir="${dir%/*}"
  10.     done
  11.     for dir in $dirs; do
  12.     [ -d "$dir" ] || mkdir $dir
  13.     done
  14. }
  15.  
  16. fstab=$(
  17.     for i in /lib/partman/fstab.d/*; do
  18.     [ -x "$i" ] || continue
  19.     $i
  20.     done |
  21.     while read fs mp type options dump pass; do
  22.     echo $mp $fs $type $options $dump $pass
  23.     done |
  24.     sort |
  25.     while read mp fs type options dump pass; do
  26.     echo $fs $mp $type $options $dump $pass
  27.     done
  28. )
  29.  
  30. IFS="$NL"
  31. for f in $fstab; do
  32.     restore_ifs
  33.     set -- $f
  34.     case "$2" in
  35.     /media/*)
  36.         installdir "/target$2"
  37.         continue
  38.     ;;
  39.     /*)
  40.         installdir "/target$2"
  41.     ;;
  42.     esac
  43.     for m in /lib/partman/mount.d/*; do
  44.     [ -x "$m" ] || continue
  45.  
  46.     # partman-doc specifies that mount.d scripts output the command
  47.     # needed to unmount the partition; currently this is unused
  48.     unmount_cmd=$($m "$f")
  49.     if [ "$?" = 0 ]; then
  50.         case $2 in
  51.         /)
  52.             # create these before /var is mounted, so that udev can
  53.             # use them
  54.             installdir /target/var/lock
  55.             installdir /target/var/run
  56.         ;;
  57.         esac
  58.         continue 2
  59.     fi
  60.     done
  61.  
  62.     db_subst partman-target/mount_failed DEVICE $(humandev $1)
  63.     db_subst partman-target/mount_failed MOUNTPOINT $2
  64.     db_subst partman-target/mount_failed TYPE $3
  65.     db_input critical partman-target/mount_failed || true
  66.     db_go || exit 1
  67.     db_get partman-target/mount_failed
  68.     if [ "$RET" = true ]; then
  69.     exit 1
  70.     else
  71.     exit 2
  72.     fi
  73. done
  74.